package com.lyfx.search.web;

import com.lyfx.search.service.CourseSearchService;
import com.lyfx.search.vo.SearchParms;
import com.lyfx.search.vo.SearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * @author lsy
 * @create 2020-07-31-17:42
 */
@Controller
public class AllClassController {

    @Autowired
    CourseSearchService courseSearchService;

    @RequestMapping({"/all-class","/all-class.html"})
    public String allClass(SearchParms parms, Model model, HttpServletRequest request) {
        //TODO 检索和构造时，属性 相同的处理
        String queryString = request.getQueryString();
        parms.set_queryString(queryString);
        SearchResult result = courseSearchService.search(parms);

        model.addAttribute("result", result);
        return "all-class";
    }
}
